<?php
namespace Admin\Logic;

Class UploadPicLogic {

    public function LoadIgoodimg($picname,$url){
        $image  = new \Think\Image(); 						// 实例化图片处理类
        $localroot = './Public/Widget/webuploader/0.1.5/server/upload2/';
        // 按照原图的比例生成一个最大为100*100的缩略图并保存为'100_'.$picname
        $success = new \Service\OssClient('LTAI6sZcsEa0SGHc','053o9lXKyeLh1J1nmlykMg0z8N0Q5E','gxxj.oss-cn-hangzhou.aliyuncs.com');
        $name=time().rand(10000,99999).".".explode(".",$picname)[1];
        $object1 = $url.$name;
        $filePath1 = $localroot.$picname;
        try{
            $success->uploadFile('gxxj', $object1, $filePath1);
            unlink($localroot.$picname);
            $success=null;
            $pic['status']=1;
            $pic['pic'] = "http://gxxj.oss-cn-hangzhou.aliyuncs.com/".$url.$name;
            return $pic;
        }
        catch(OssException $e) {
            $pic['status']=2;
            return $pic;
        }
    }

}
?>